package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class WriteStringDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("test.txt",true);
        String line = "我曾经跨过山和大海 也穿过人山人海";
        byte[] data = line.getBytes(StandardCharsets.UTF_8);
        fos.write(data);
        line = "我曾经拥有着的一切 转眼都飘散如烟";
        data = line.getBytes(StandardCharsets.UTF_8);
        fos.write(data);

        System.out.println("写出完毕");
        fos.close();
    }
}
